home *** CD-ROM | disk | FTP | other *** search
- package java.beans;
-
- import java.applet.Applet;
- import java.applet.AppletContext;
- import java.applet.AudioClip;
- import java.awt.Image;
- import java.awt.image.ImageProducer;
- import java.net.URL;
- import java.util.Enumeration;
- import java.util.Hashtable;
- import java.util.Vector;
-
- class BeansAppletContext implements AppletContext {
- Applet target;
- Hashtable imageCache = new Hashtable();
-
- BeansAppletContext(Applet target) {
- this.target = target;
- }
-
- public Applet getApplet(String name) {
- return null;
- }
-
- public Enumeration getApplets() {
- Vector applets = new Vector();
- applets.addElement(this.target);
- return applets.elements();
- }
-
- public AudioClip getAudioClip(URL url) {
- try {
- return (AudioClip)url.getContent();
- } catch (Exception var2) {
- return null;
- }
- }
-
- public synchronized Image getImage(URL url) {
- Object o = this.imageCache.get(url);
- if (o != null) {
- return (Image)o;
- } else {
- try {
- o = url.getContent();
- if (o == null) {
- return null;
- } else if (o instanceof Image) {
- this.imageCache.put(url, o);
- return (Image)o;
- } else {
- Image img = this.target.createImage((ImageProducer)o);
- this.imageCache.put(url, img);
- return img;
- }
- } catch (Exception var4) {
- return null;
- }
- }
- }
-
- public void showDocument(URL url) {
- }
-
- public void showDocument(URL url, String target) {
- }
-
- public void showStatus(String status) {
- }
- }
-